SYSTEMTIME (Structures)
Last changed: -45.137.113.229

.
Summary
Represents a date and time using individual members for the month, day, year, weekday, hour, minute, second, and millisecond.

C# Definition:

[Serializable, StructLayout(LayoutKind.Sequential)]
public struct SYSTEMTIME
{
   [MarshalAs(UnmanagedType.U2)] public short Year;
   [MarshalAs(UnmanagedType.U2)] public short Month;
   [MarshalAs(UnmanagedType.U2)] public short DayOfWeek;
   [MarshalAs(UnmanagedType.U2)] public short Day;
   [MarshalAs(UnmanagedType.U2)] public short Hour;
   [MarshalAs(UnmanagedType.U2)] public short Minute;
   [MarshalAs(UnmanagedType.U2)] public short Second;
   [MarshalAs(UnmanagedType.U2)] public short Milliseconds;

   public SYSTEMTIME(short year, short month, short dayOfWeek, short day, short, hour, short minute, short second, short milliseconds)
   {
     this.Year = year;
     this.Month = month;
     this.DayOfWeek = dayOfWeek;
     this.Day = day;
     this.Hour = hour;
     this.Minute = minute;
     this.Second = second;
     this.Milliseconds = milliseconds;
   }

   public DateTime ToDateTime()
   {
     if (Year == 0)
       return DateTime.MinValue;

     return new DateTime(Year, Month, Day, Hour, Minute, Second, Milliseconds);
   }

   public static SYSTEMTIME FromDateTime(DateTime dateTime)
   {
     return new SYSTEMTIME((short)dateTime.Year, (short)dateTime.Month, (short)dateTime.DayOfWeek, (short)dateTime.Day, (short)dateTime.Hour, (short)dateTime.Minute, (short)dateTime.Second, (short)dateTime.Millisecond);
   }
}

VB Definition:

<Serializable, StructLayout(LayoutKind.Sequential)>
Public Class SYSTEMTIME
   <MarshalAs(UnmanagedType.U2)> Public Year As Short
   <MarshalAs(UnmanagedType.U2)> Public Month As Short
   <MarshalAs(UnmanagedType.U2)> Public DayOfWeek As Short
   <MarshalAs(UnmanagedType.U2)> Public Day As Short
   <MarshalAs(UnmanagedType.U2)> Public Hour As Short
   <MarshalAs(UnmanagedType.U2)> Public Minute As Short
   <MarshalAs(UnmanagedType.U2)> Public Second As Short
   <MarshalAs(UnmanagedType.U2)> Public Milliseconds As Short
End Class

Notes:

This can be used when a PInvoke signature requires a "Win32 SYSTEMTIME" otherwise you should be using System.DateTime.

Tips & Tricks:

Please add some!

Documentation
SYSTEMTIME on MSDN